//Name: Cao Dung Anh
//Class: 11CTT
//Sid: 1151003

#pragma once
#include "UserInfo.h"

class UserList
{
private:
	typedef struct Node
	{
		UserInfo data;
		Node* next;
	}abc;
	Node *head;
	Node *subhead;
public:

	UserList();
	void addUsertoFile();
	void addUsertoFile(int usertype);
	void loadUserList();
	void updateUserList();
	bool showAllForAdmin();
	bool showAllForLib();
	void showsublist();
	bool checkUserName(char *username);
	char* checkAccount(char *username,char *pass);
	int checkUserType(char *username);
	int getStatusbyUsername(char* username);
	
	//Set these filter functions to type bool so that
	//is there is no account found, it will return false
	bool filterbyUserType();
	bool filterbyAccStatus(int num);
	bool filterbyAccStatusforLib(int num);
	bool filterbyUserName();
	bool filterbyUserNameforLib();
	bool filterbyName();
	bool filterbyNameforLib();
	bool filterbyUserTypeAdmin();
	bool filterbyUserTypeLibrarian();
	bool filterbyUserTypeReader();
	void modifyAcc();
	void banAcc(int num);
	void unbanAcc(int num);
	//delete account
	char *FindUsername(int num);
	void deleteAcc(char* username);
	void resetPassword(int num);
	void addNodetoSubList(Node *cur);
	void welcome(char *username);
	void changeYourPassword(char* username);
	bool isNumber(char *cChoice);
	int convertStringtoNum(char *str);
	void activateAnUser(int num);//Activate an user
	void activateSomeUsers(int *ul);//Activate some users with ul is the list of those numbers
	void activateAllUser();//Activate all inactivated users
	void freeSubhead();//This function will delete the subhead
	void freeHead();//Delete linked list with head is Head


	//16/5
	void showUserInfo(char *username);
	void sortbyNameAscending();
	void sortbyNameDescending();
	void sortbyUserNameAscending();
	void sortbyUserNameDescending();
	void sortbyAccountStatusAscending();
	void sortbyAccountStatusDescending();
	void sortbyUserTypeAscending();
	void sortbyUserTypeDescending();
	

	void WriteUserInfoXMLfile();
	void WriteUserInfoCSVfile();
};